<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>首页</title>
<script type="text/javascript" src="../../js/jquery.min.js"></script>
<script type="text/javascript" src="../../js/ajax-fileuploader/ajaxfileupload.js"></script>
<link type="text/css" href="../../css/mainframe.css" rel="stylesheet" />
<link type="text/css" href="../../css/maincontent.css" rel="stylesheet" />
<link type="text/css" href="../../css/daterangepicker.css" rel="stylesheet" />
<link type="text/css" href="../../css/street.css" rel="stylesheet" />
<link type="text/css" href="../../css/bootstrap.css" rel="stylesheet" />
<link type="text/css" href="../../css/styles.css" rel="stylesheet" />

<link rel="stylesheet" href="../../js/validator-0.7.0/jquery.validator.css"/>
<script type="text/javascript" src="../../js/validator-0.7.0/jquery.validator.js"></script>
<script type="text/javascript" src="../../js/validator-0.7.0/local/zh_CN.js"></script>

<script type="text/javascript" src="../../js/public.js"></script>
<script type="text/javascript" src="../../js/jquery.validate.js"></script>
<script type="text/javascript" src="../../js/My97DatePicker/WdatePicker.js"></script>

<script charset="utf-8" src="http://map.qq.com/api/js?v=2.exp"></script>
<style type="text/css">
    * {
        margin: 0px;
        padding: 0px;
    }
    body,
    button,
    input,
    select,
    textarea {
        font: 12px/16px Verdana, Helvetica, Arial, sans-serif;
    }
    #info {
        width: 603px;
        padding-top: 3px;
        overflow: hidden;
    }
    .btn {
        width: 190px;
    }
    .shezhi_box{margin-bottom: 5px;}
</style>
<script>
var map;
var circle;
var center;
    function init(id) {
    	var rad = $("#rad").val();
    	if(rad==''){
    		rad=0;
    	}else{
    		 rad = parseInt($("#rad").val());
    	}
    	
    	if(id == 1){
    		center = new qq.maps.LatLng(22.52346, 113.9393);
    		sss();
    	}else{
    		center = new qq.maps.LatLng($("#weidu").val(), $("#jingdu").val());
    		map = new qq.maps.Map(document.getElementById("container"), {
                center: center,
                zoom: 17
            });
        	circle = new qq.maps.Circle({
                map: map,
                center: center,
                radius: rad,
                strokeWeight: 3
            });
    	}
         show();
    } 
</script>
<script type="text/javascript">
function sss(){
	map = new qq.maps.Map(document.getElementById("container"), {
        center: center,
        zoom: 17
    });
	circle = new qq.maps.Circle({
        map: map,
        center: center,
        radius: 50,
        strokeWeight: 3
    });
}
</script>
 <script>
function show(){
 qq.maps.event.addListener(map, "click", function(event) {
	 $("#weidu").val(event.latLng.getLat());
	 $("#jingdu").val(event.latLng.getLng());
         circle.setVisible(true);
         init(2);
     });
}
</script>
<style type="text/css">
	 #uploadBackground {
   float:left;                      
    background-position: center center;
    background-size: 180px 130px;
    border: 4px solid #fff;
    -webkit-box-shadow: 0 0 1px 1px rgba(0, 0, 0, .3);
    display: inline-block;}
    
    
    #uploadLogo {
   float:left;                        
    background-position: center center;
    background-size: 180px 130px;
    border: 4px solid #fff;
    -webkit-box-shadow: 0 0 1px 1px rgba(0, 0, 0, .3);
    display: inline-block;}
    
     #uploadTwo {
   float:left;                         
    background-position: center center;
    background-size: 180px 130px;
    border: 4px solid #fff;
    -webkit-box-shadow: 0 0 1px 1px rgba(0, 0, 0, .3);
    display: inline-block;}
    .remove_one_bu{margin-left: 180px;}
    .delete_one_bu{margin-left: 83px;}
</style>
<script type="text/javascript">
function  nextone(){
  document.getElementById("first_step").style.display="none";
  document.getElementById("second_step").style.display="block";
  document.getElementById("thirdly_step").style.display="none";
 }
 function  nexttwo(){
  document.getElementById("first_step").style.display="block";
  document.getElementById("second_step").style.display="none";
  document.getElementById("thirdly_step").style.display="none";
 }
 function  nextthree(){
  document.getElementById("first_step").style.display="none";
  document.getElementById("second_step").style.display="none";
  document.getElementById("thirdly_step").style.display="block";
 }
 function  nextfour(){
  document.getElementById("first_step").style.display="none";
  document.getElementById("second_step").style.display="block";
  document.getElementById("thirdly_step").style.display="none";
 } 
 
</script>
<script type="text/javascript">
var num = 0;
function suiji(num){
 document.getElementById("guding"+num).style.display="none";
 document.getElementById("suiji"+num).style.display="block";
}
function guding(num){
 document.getElementById("suiji"+num).style.display="none";
 document.getElementById("guding"+num).style.display="block";
}

function addElement(){		
 if(num < 50){
  num = parseInt(num)+1;
  $("#content").append(
			'<div id="contentdetail'+num+'">'
			+'<div id="fuzhi">'
			 + '<div class="search">'
			 		 +'<div class="wod">活动时间选择</div>'
			  		 +'<input class="txt form-control" type="text" name="hbRuleList['+num+'].startTime" id="startTime'+num+'" onfocus="WdatePicker({skin:\'whyGreen\',dateFmt:\'HH:mm:ss\',minDate:\'#F{$dp.$D(\\\'endTime'+(num-1)+'\\\')}\',maxDate:\'#F{$dp.$D(\\\'endTime'+num+'\\\')}\'})">'
			         +'<div class="wod" style="width: auto;">到</div>'
			         +'<input class="txt form-control" type="text" name="hbRuleList['+num+'].endTime" id="endTime'+num+'" onfocus="WdatePicker({dateFmt:\'HH:mm:ss\',minDate:\'#F{$dp.$D(\\\'startTime'+num+'\\\')}\'})">'
			         +'<div class="clearfix"></div>'
			    +'</div>'
			  +'<div class="search">'
			 		 +'<div class="wod">选择红包类型</div>'	
					 +'<label><input class="rad" type="radio" name="hbRuleList['+num+'].type" value="2" onclick="suiji('+num+')" checked="checked" />随机红包</label>'
					 +'<label><input class="rad" type="radio" name="hbRuleList['+num+'].type" value="1" onclick="guding('+num+')" />固定红包</label>'
	  		  		 +'<div class="clearfix"></div>'
	  		  +'</div>'
	  		  +'<div id="suiji'+num+'">'
		  		    +'<div class="block">'
		  		    	+'<span class="wod">随机红包最小金额：</span>'
		  		  		+' <input class="txt form-control" type="text" id="startPrice'+num+'" name="hbRuleList['+num+'].startPrice" />'
		  		  		+'<span class="tip">随机红包最大金额</span>'
						+'<input class="txt form-control" type="text" id="endPrice'+num+'" name="hbRuleList['+num+'].endPrice" style="margin-left: 10px;" onblur="shijiao('+num+')" />'
		  		  		+'<span class="tip">元</span><span class="last_tip">（红包最小值为1元，最大为200元）</span>'
		  		 	    +'<div class="clearfix"></div>'
		  		 	  +'</div>'
	  		  +'</div>'
	  		  +'<div id="guding'+num+'" style="display: none;">'
	 		  		+' <div class="block">'
	 		  			+'<span class="wod">固定红包最大金额：</span>'
	 		  			+'<input class="txt form-control" type="text" id="price'+num+'" name="hbRuleList['+num+'].price" onblur="shijiao('+num+')"/>'
	  		  			+'<span class="tip">元</span><span class="last_tip">（红包最小值为1元，最大为200元）</span>'
	  		  			+'<div class="clearfix"></div>'
	  		  		+'</div>'
	 		   +' </div>'
	 		  +' <div class="block">'
 		    	+'<span class="wod">红包个数：</span>'
 		        +' <input class="txt form-control" type="text" id="num'+num+'" name="hbRuleList['+num+'].num" onblur="shijiao('+num+')"/>'
 		        +'<span class="tip"><span>个</span></span>'
 		        +' <div class="clearfix"></div>'
		      +'</div>'
		      +'<div class="block">'
		         +'<span class="wod">合算红包总金额：</span>'
		         +'<span class="name"><span id="priceNum'+num+'"></span></span>'
		         +'<div class="clearfix"></div>'
		      +'</div>'
	 	+'</div>'
	 +'<div id="kongbai" style="background-color:#fff;"></div>'
+'<div>');
 }
 return false;
}
function dropElement()
{
if(num < 1){
	return;
}else{
	$("#contentdetail"+num).remove();	
	num = parseInt(num)-1;
}
}
</script>
<script type="text/javascript">
$(document).ready(function(){
	$('#frm').validator({
		theme:'yellow_right_effect',
	    stopOnError:true,
	    focusInvalid :true,
	    fields: {
			"title": {
	            rule: "required;",
	            ok: "",
	        },
	        "shareContext": {
	            rule: "required;",
	            ok: "",
	        },
	        "activityExplain": {
	            rule: "required;",
	            ok: "",
	        },
	        "sceneList[0].link":{
	        	rule:"required",
	        	ok: "",
	        }
	    }
	})
	.on("click", "#addActivity", function(){
		addActivity();
	});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
  $("#test").change(function(){ 
		$("#city").html("");
		$("#town").html("");
	
		$.post("./city.sys",{'provinceCode':$("#test").val()},function(data){
			
			var OptionValue = "<option value='0'>请选择</option>";
			
			for(var j in data){
				OptionValue = OptionValue+"<option data-name="+data[j].name+" value='"+data[j].code+"'>"+data[j].name+"</option>";
			}
			$("#city").append(OptionValue);
			$("#areaId").val($("#test").find("option:selected").text());
		});
	 });
	$("#city").change(function(){
		$("#town").html("");
		$.post("./town.sys",{'cityCode':$("#city").val()},function(data){
			
			var OptionValue1 = "<option value='0'>请选择</option>";
			
			for(var j in data){
				OptionValue1 = OptionValue1+"<option value='"+data[j].code+"'>"+data[j].name+"</option>";
			}
			$("#town").append(OptionValue1);
			$("#areaId").val($("#city").find("option:selected").text());
		});
	});
	$("#town").change(function(){
		$("#areaId").val($("#town").find("option:selected").text());
	});
});
function addActivity(){
	$("#frm").trigger("validate");
	if(yanzheng(num) == false || verificationUrl() == false || verificationTime()==false || verificationArea() == false){
		return false;
	}else{
		if($("#frm").isValid()){
			$.get("./addActivity.sys",$("#frm").serialize(),function(data){
				if(data.code == 1){
					window.location = "../dataList/activityList.sys?token="+data.token+"&accountId="+data.accountId;
				}else if(data.code == -1){
					window.location = "../login/toLogin.sys";
				}else{
					alert("保存失败");
					return false;
				}
			});
		}
	}
	
}
  </script>
<script type="text/javascript">
function yanzheng(num){
	var radio = $('input[name="hbRuleList['+num+'].type"]:checked').val();
	//最小金额
	var startPrice = $("#startPrice"+num).val();
	//最大金额
	var endPrice = $("#endPrice"+num).val();
	//固定金额
	var price = $("#price"+num).val();
	//红包个数
	var num = $("#num"+num).val();
	//只要包含中文或者字母就提示
	var reg = /([\u4E00-\u9FA5]|[A-Za-z])+/;
	if(radio == "1"){
		if(price == ""){
			alert("请输入固定红包金额");
			return false;
		}
	}else{
		if(startPrice == ""){
			alert("请输入随机红包最小金额");
			return false;
		}else if(endPrice == ""){
			alert("请输入随机红包最大金额");
			return false;
		}
	}
	if(reg.test(startPrice) || reg.test(endPrice) || reg.test(num) || reg.test(price)){
		alert("不能输入中文或者字母");
		return false;
	}
	if(num == ""){
		alert("请输入红包个数");
		return false;
	}
	return true;
}
</script>
<script type="text/javascript">
function verificationArea(){
	//获取区域类型
	var quyutype = $("#quyutype").val();
	var test = $("#test").val();
	if(quyutype == "1"){
		if(test == ""){
			alert("请选择省份");
			return false;
		}
	}
	return true;
}
</script>
<script type="text/javascript">
//验证时间
function verificationTime(){
	var seltype = $("#seltype").val();
	//获取背景图
	var homeBackGround = $("#homeBackGround").val();
	//获取logo
	var logoTu = $("#logoTu").val();
	//获取二维码
	var twoImgLogo = $("#twoImgLogo").val();
	//获取活动开始时间
	var startTime = $("#startTime").val();
	var endTime = $("#endTime").val();
	//获取公众号
	var wxdata = $("#wxdata").val();
	if(homeBackGround == ""){
		alert("请上传背景图");
		return false;
	}
	if(logoTu == ""){
		alert("请上传logo");
		return false;
	}
	if(seltype == "0"){
		if(twoImgLogo == ""){
			alert("请上传二维码");
			return false;
		}
	}
	if(startTime == ""){
		alert("请输入活动开始时间");
		return false;
	}
	if(endTime == ""){
		alert("请输入活动结束时间");
		return false;
	}
	if(wxdata == "" || wxdata == null){
		alert("请选择公众号");
		return false;
	}
	return true;
}
</script>
<script type="text/javascript">
function verificationUrl(){
	var projectUrl0 = $("#projectUrl0").val();
	var projectUrl1 = $("#projectUrl1").val();
	var shareUrl = $("#shareUrl").val();
	var outLink = $("#outLink").val();
	var reg = /((https|http)?:\/\/)[^\s]/;
	if(projectUrl0 == ""){
		return true;
	}else{
		if(!reg.test(projectUrl0)){
			alert("请输入http://或https://开头的正确项目连接");
			return false;
		}
	}
	if(projectUrl1 == ""){
		return true;
	}else{
		if(!reg.test(projectUrl1)){
			alert("请输入http://或https://开头的正确项目连接");
			return false;
		}
	}
	if(shareUrl == ""){
		return true;
	}else{
		if(!reg.test(shareUrl)){
			alert("请输入http://或https://开头的正确项目连接");
			return false;
		}
	}
	if(outLink == ""){
		return true;
	}else{
		if(!reg.test(outLink)){
			alert("请输入http://或https://开头的正确项目连接");
			return false;
		}
	}
	return true;
}
</script>
<script type="text/javascript">
/**
* 显示图片
*/
	function showBackground(id){
	    var elementFile=document.getElementById("imgFile");
	    if(!isbackImg()){
	    	$("#uploadBackground").html('');
	    	return false;
	    }else{
	    	var showarea=$("#uploadBackground")[0];
			var files = !!elementFile.files ? elementFile.files : [];
			if (!files.length || !window.FileReader) return;
			  var reader = new FileReader();
			   reader.readAsDataURL(files[0]);
			   	reader.onload  = function(){
			   	var img = new Image();
			   	 img.src = this.result;
			   	 //console.log(img.onload);
			     	img.onload = function() {
			    		if(this.width>645){
		            		alert("上传图片尺寸最大宽度要求为645像素，您的图片大了"+(this.width-645)+"像素,请重新选择！");
		            		$("#uploadBackground").html('');
		            		return false;
		            	}else if(this.width<635){
		            		alert("上传图片尺寸宽度最小要求为635像素，您的图片小了"+(635-this.width)+"像素,请重新选择！");
		            		$("#uploadBackground").html('');
		            		return false;
		            	}else if(this.height>1013){
		            		alert("上传图片尺寸最大宽度要求为1013像素，您的图片大了"+(this.height-1013)+"像素,请重新选择！");
		            		$("#uploadBackground").html('');
		            		return false;
		            	}else if(this.height<1003){
		            		alert("上传图片尺寸宽度最小要求为1003像素，您的图片小了"+(1003-this.height)+"像素,请重新选择！");
		            		$("#uploadBackground").html('');
		            		return false;
		            	}else{
		            		$("#uploadBackground").html(this);
		            		$(this).css({"width": "200px", "height": "200px"});
		            		saveImgtt(id);
		            	}
			    	} 
			    };
	    }
	}
	function isbackImg(){
	    var f=$("#imgFile").val();
			if(f==""){
	 		alert("请上传图片");
	 		return false;
			}else{
			if(!/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(f)) {
	 			 alert("图片类型必须是.gif,jpeg,jpg,png中的一种")
	 	    	 return false;
		   		 }else{
		    		 return true;
		    }
	}
	}
</script>
<script type="text/javascript">
/**
 * ajax背景图上传
 */
 function saveImgtt(pid){
 	var urlPic="upload.sys";
 		$.ajaxFileUpload({
 			url:urlPic,
 			secureuri:false,
 			fileElementId:"imgFile",
 			dataType:'json',
 			data:{
 				preImg:$("#homeBackGround").val(),
 				id:pid
 			},
 			beforeSend:function(){
 			},
 			complete:function(){
 			},				
 			success: function (data, status){
 				//上传成功 将图片的路径写入隐藏域
 				if(data.code==-3){
 					alert(data.message)
 				}else if(data.code==1){
 					$("#homeBackGround").val(data.url);
 				}
 			},
 			error: function (data, status, e){
 				alert("上传失败");
 			}
 		});	
 	}
</script>

<script type="text/javascript">
/**
 * 显示图片
 */
 function showLogo(id){
	  	var elementFile=document.getElementById("imgLogoTu");
	  	if(!isLogImg()){
	  		$("#uploadLogo").html('');
	    	return false;
	    }else{
	    	var showarea=$("#uploadLogo");
		  	var files = !!elementFile.files ? elementFile.files : [0];
		  	if (!files.length || !window.FileReader) return;
		  	var reader = new FileReader();
		  	   reader.readAsDataURL(files[0]);
		  	   	reader.onloadend = function(){
		  	   	var img = new Image();
			   	 img.src = this.result;
			   	 //console.log(img.onload);
			  	img.onload = function() {
		    		if(this.width>439){
		    			alert("上传图片尺寸最大宽度要求为439像素，您的图片大了"+(this.width-439)+"像素,请重新选择！");
	            		$("#uploadLogo").html('');
	            		return false;
	            	}else if(this.width<429){
	            		alert("上传图片尺寸宽度最小要求为429像素，您的图片小了"+(429-this.width)+"像素,请重新选择！");
	            		$("#uploadLogo").html('');
	            		return false;
	            	}else if(this.height>115){
	            		alert("上传图片尺寸最大宽度要求为115像素，您的图片大了"+(this.height-115)+"像素,请重新选择！");
	            		$("#uploadLogo").html('');
	            		return false;
	            	}else if(this.height<105){
	            		alert("上传图片尺寸宽度最小要求为105像素，您的图片小了"+(105-this.height)+"像素,请重新选择！");
	            		$("#uploadLogo").html('');
	            		return false;
	            	}else{
	            		$("#uploadLogo").html(this);
	            		$(this).css({"width": "200px", "height": "200px"});
	            		saveLogo(id);
	            	}
		    	} 
		  	  };
	    }
	  }
	  
	  function isLogImg(){
	        var f=$("#imgLogoTu").val();
	  		if(f==""){
	     		alert("请上传图片");
	     		return false;
	  		}else{
	    		if(!/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(f)) {
	     			 alert("图片类型必须是.gif,jpeg,jpg,png中的一种")
	     	    	 return false;
	   	   		 }else{
	   	    		 return true;
	   	    }
	  }
	}
</script>
<script type="text/javascript">
/**
 * ajaxLogo上传
 */
function saveLogo(pid){
var urlPic="upload.sys";
	$.ajaxFileUpload({
		url:urlPic,
		secureuri:false,
		fileElementId:"imgLogoTu",
		dataType:'json',
		data:{
			preImg:$("#logoTu").val(),
			id:pid
		},
		beforeSend:function(){
		},
		complete:function(){
		},				
		success: function (data, status){
			//上传成功 将图片的路径写入隐藏域
			if(data.code==-3){
				alert(data.message)
			}else if(data.code==1){
				$("#logoTu").val(data.url);
			}
			
		},
		error: function (data, status, e){
			alert("上传失败");
		}
	});	
}
</script>
<script type="text/javascript">
 function shijiao(id){   
 	var arg1 = $("#endPrice"+id).val();
 	var arg2 = $("#price"+id).val();
	var arg3 = $("#num"+id).val();
 	var radio = $("input[name='hbRuleList["+id+"].type']:checked").val();
	if(radio == 1){
 		//如果radio等于1  固定红包
  		var sum= accMul(arg2,arg3);
  	  	$("#priceNum"+id).html(sum);
 	}else{
 		//如果radio等于2   随机红包
 		var num= accMul(arg1,arg3);
 		$("#priceNum"+id).html(num);
	}
 }   
 function accMul(arg1,arg2){   
 	var m=0,s1=arg1.toString(),s2=arg2.toString();   
 	try{m+=s1.split(".")[1].length}catch(e){}   
 	try{m+=s2.split(".")[1].length}catch(e){}   
 	return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)   
 } 
 </script>
<script type="text/javascript">
function showTwo(id){
	var elementFile=document.getElementById("tp1");
	if(!isTwoImg()){
  		$("#uploadTwo").html('');
    	return false;
    }else{
    	var showarea=$("#uploadTwo");
	  	var files = !!elementFile.files ? elementFile.files : [0];
	  	if (!files.length || !window.FileReader) return;
	  	var reader = new FileReader();
	  	   reader.readAsDataURL(files[0]);
	  		reader.onloadend = function(){
		  	   	var img = new Image();
			   	 img.src = this.result;
			   	 //console.log(img.onload);
			  	img.onload = function() {
		    		if(this.width>105){
		    			alert("上传图片尺寸最大宽度要求为105像素，您的图片大了"+(this.width-105)+"像素,请重新选择！");
	            		$("#uploadTwo").html('');
	            		return false;
	            	}else if(this.width<95){
	            		alert("上传图片尺寸宽度最小要求为95像素，您的图片小了"+(95-this.width)+"像素,请重新选择！");
	            		$("#uploadTwo").html('');
	            		return false;
	            	}else if(this.height>105){
	            		alert("上传图片尺寸最大宽度要求为105像素，您的图片大了"+(this.height-105)+"像素,请重新选择！");
	            		$("#uploadTwo").html('');
	            		return false;
	            	}else if(this.height<95){
	            		alert("上传图片尺寸宽度最小要求为95像素，您的图片小了"+(95-this.height)+"像素,请重新选择！");
	            		$("#uploadTwo").html('');
	            		return false;
	            	}else{
	            		$("#uploadTwo").html(this);
	            		$(this).css({"width": "200px", "height": "200px"});
	            		saveTwoLogo(id);
	            	}
		    	} 
		  	  };
    }
 }
 function isTwoImg(){
     var f=$("#tp1").val();
		if(f==""){
  		alert("请上传图片");
  		return false;
		}else{
 		if(!/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(f)) {
  			 alert("图片类型必须是.gif,jpeg,jpg,png中的一种")
  	    	 return false;
	   		 }else{
	    		 return true;
	    }
}
}
 </script>
<script type="text/javascript">
/**
 * 二维码上传
 */
function saveTwoLogo(pid){
var urlPic="upload.sys";
	$.ajaxFileUpload({
		url:urlPic,
		secureuri:false,
		fileElementId:"tp1",
		dataType:'json',
		data:{
			preImg:$("#twoImgLogo").val(),
			id:pid
		},
		beforeSend:function(){
		},
		complete:function(){
		},				
		success: function (data, status){
			//上传成功 将图片的路径写入隐藏域
			if(data.code==-3){
				alert(data.message)
			}else if(data.code==1){
				$("#twoImgLogo").val(data.url);
			}
			
		},
		error: function (data, status, e){
			alert("上传失败");
		}
	});	
}
</script>
</head>
<body onload="init(1)">
      <form id="frm">
      		<input type="hidden" id="homeBackGround" name="homeBackGround"/>
	 	 	<input type="hidden" id="logoTu" name="logo"/>
	 	 	<input type="hidden" id="areaId" name="location"/>
	 	 	<input type="hidden" value="${awardType}" name="awardType"/>
	 	 	<input type="hidden" value="${accountId }" name="accountId"/>
	 	 	<input type="hidden" value="${token }" name="token"/>
	      	<aside class="platform-r-aside">
			  <div class="p30" id="first_step">
	        <div  class="aside-r-con">
	            <ul class="jj-breadcrumb">
	            	<li><a >活动列表</a></li>
	            	<li><a >活动创建</a></li>         	
	            </ul>
				<ul class="logo_chuan">
					<li><div class="bu_word">背景图</div></li>
					<li><div class="chuan_one"><input type="file" name="imgLogo1" id="imgFile" style="filter:alpha(opacity=0);opacity:0" onchange="showBackground('1')"/><p class="top_chuan">上传</p></div></li>
					<li class="one_rule">（背景图尺寸为640*1008像素）</li>
					<li><div id="uploadBackground"></div></li>
				</ul>
				<ul class="pic_chuan">
					<li>
					    <li><div class="bu_word">LOGO</div></li>
					    <li><div class="chuan_one"><input type="file" name="imgLogo2" id="imgLogoTu" style="filter:alpha(opacity=0);opacity:0" onchange="showLogo('2')"/><p class="top_chuan">上传</p></div></li>
					    <li class="one_rule">（LOGO图尺寸为434*110）</li>
						<li><div id="uploadLogo"></div></li>
					</li>
				</ul>
				<ul class="huodong_chuan">
				    <li><div class="huodong_name">活动说明</div></li>
				    <li><textarea class="one_bu_number01 form-control" id="activityExplain" name="activityExplain" rows="5" cols="40"></textarea></li>
				    <li><span class="msg-box n-right" for="activityExplain"></span></li>
				</ul>
				<ul class="huodong_chuan">
				    <li><div class="huodong_name">活动名称</div></li>
				    <li><input type="text" id="title" name="title" class="form-control one_bu_number"/></li>
				    <li><span class="msg-box n-right" for="title"></span></li>
				</ul>
	                    
				<div class="one_bu_time">
					<label class="time_qian">活动时间</label>
					<input class="time time_input1" type="text" id="startTime" name="startTime" onfocus="WdatePicker({skin:'whyGreen',minDate:'%y-%M-{%d} H:m:s',maxDate:'#F{$dp.$D(\'endTime\')}'})">
					<label class="time_dao">到</label>
					<input class="time time_input2" type="text" id="endTime" name="endTime" onfocus="WdatePicker({skin:'whyGreen',minDate:'#F{$dp.$D(\'startTime\')}',maxDate:'2040-10-01 00:00:00'})">
					<span class="msg-box n-right" id="dataTime"></span>
				</div>
				<br /> <br />
				<div class="one_number">
					<label class="bu_number_word">活动电话</label>
					<input name="tel" type="text" value="" id="" class="form-control one_bu_number" placeholder=""/>
					<span class="msg-box n-right" for="tel"></span>
				</div>
					<div class="changjing_shezhi" id="InputsWrapper">
					    <label class="shezhi_qian">场景设置</label>
					    <input type="text" id="scene0" class="shezhi_box" name="sceneList[0].link" style="display: block;"/>
					    <span class="msg-box n-right" for="sceneList[0].link"></span>
					</div>
					<div class="delete_one_bu"><input type="button" name=""  value="" style="filter:alpha(opacity=0);opacity:0" /><a class="top_delete"href="###" id="AddMoreFileBox">添加</a></div>
					<div class="remove_one_bu removeclass"><input type="button" name="" value="" style="filter:alpha(opacity=0);opacity:0" /><a class="top_remove"  id="shan"href="###" style="color:#fff;">删除</a></div>
					<p class="one_bu_xian" style="margin-top: 43px;margin-left: 83px;">(链接最多十条)</p>
				<input type="button" id="" value="下一步" onclick="nextone()" class="next_bu" style="margin-left: 83px;"/>
				
			</div>
			</div>
			  <div class="rightbox" style="display: none;"  id="second_step">
			  		<input type="hidden" id="twoImgLogo" name="twoLogo"/>
				  <div class="path">活动列表<span class="arrow">&gt;</span>详情创建</div>
				  <div class="tit">页面内容设置</div>
				  <div class="block">
					  <span class="name">功能类型选择</span>
					  <select class="sel" id="seltype" name="type">
						  <option value="0" selected="selected" >二维码</option>
						  <option value="1">电话</option>
					  </select>
					  <ul class="pic_chuan1" id="tp2">
						<li>
							<li><div class="chuan_one"><input type="file" name="imgLogo3" id="tp1" style="filter:alpha(opacity=0);opacity:0" onchange="showTwo('3')"/><p class="top_chuan">上传</p></div></li>
							<li class="one_rule">（尺寸为100×100）</li>
							<li><div id="uploadTwo"></div></li>
						</li>
					</ul>
					<div class="clearfix"></div>
				  </div>
				  <div class="tit">按钮功能设置</div>
				  <div class="block">
					  <span class="name">项目链接</span>
					  <input class="txt form-control" id="projectUrl0" type="text" name="hbShareList[0].projectUrl"/>
					  <span class="name">内容文字</span>
					  <input class="txt form-control" type="text" name="hbShareList[0].projectContext"/>
					  <div class="clearfix"></div>
				  </div>
				  <div class="block">
					  <span class="name">项目链接</span>
					  <input class="txt form-control" id="projectUrl1" type="text" name="hbShareList[1].projectUrl"/>
					  <span class="name">内容文字</span>
					  <input class="txt form-control" type="text" name="hbShareList[1].projectContext"/>
					  <div class="clearfix"></div>
				  </div>
				  <div class="block">
					  <span class="name">分享链接</span>
					  <input class="txt form-control" id="shareUrl" type="text" name="shareUrl"/>
					  <span class="name">街景外链</span>
					  <input class="txt form-control" type="text" id="outLink" name="outLink"/>
					  <div class="clearfix"></div>
				  </div>
				  <div class="btnbox">
					  <a class="nextbtn" href="#" onclick="nexttwo()">上一步</a>
					  <a class="nextbtn" href="#" onclick="nextthree()">下一步</a>
					  <div class="clearfix"></div>
				  </div>
			  </div>
	
			  <div class="rightbox" style="display: none;" id="thirdly_step">
				  <div class="path">活动列表<span class="arrow">&gt;</span>详情创建<span class="arrow">&gt;</span>查看详情第三步</div>
				 <div class="div1" id="content">
					 <div id="contentdetail0">
					 	<div id="fuzhi">
							 <div class="search">
								 <div class="wod">活动时间选择</div>
								 <input class="txt form-control" type="text" name="hbRuleList[0].startTime" id="startTime0" onfocus="WdatePicker({dateFmt:'HH:mm:ss',skin:'whyGreen',maxDate:'#F{$dp.$D(\'endTime0\')}'})">
								 <div class="wod" style="width: auto;">到</div>
								 <input class="txt form-control" type="text" name="hbRuleList[0].endTime" id="endTime0" onfocus="WdatePicker({dateFmt:'HH:mm:ss',minDate:'#F{$dp.$D(\'startTime0\')}'})">
								 <div class="clearfix"></div>
							 </div>
							 <div class="search">
								 <div class="wod">选择红包类型</div>
								 <label><input class="rad" type="radio" id="radio0" name="hbRuleList[0].type" value="2" onclick="suiji(0)" checked="checked"/>随机红包</label>
								 <label><input class="rad" type="radio" id="radio0" name="hbRuleList[0].type" value="1" onclick="guding(0)" />固定红包</label>
								 <div class="clearfix"></div>
							 </div>
							 <div id="suiji0">
								 <div class="block">
									 <span class="wod">随机红包最小金额：</span>
									 <input class="txt form-control" type="text" id="startPrice0" name="hbRuleList[0].startPrice"/>
									 <span class="tip">随机红包最大金额</span>
									 <input class="txt form-control " type="text" id="endPrice0" name="hbRuleList[0].endPrice" style="margin-left: 10px;" onblur="shijiao(0)" />
									 <span class="tip">元</span><span class="last_tip">（红包最小值为1元，最大为200元）</span>
									 <div class="clearfix"></div>
								 </div>
							 </div>
							 <div id="guding0" style="display: none;">
								 <div class="block">
									 <span class="wod">固定红包最大金额：</span>
									 <input class="txt form-control" type="text" id="price0"  name="hbRuleList[0].price" onblur="shijiao(0)"/>
									 <span class="tip">元</span><span class="last_tip">（红包最小值为1元，最大为200元）</span>
									 <div class="clearfix"></div>
								 </div>
							 </div>
							 <div class="block">
								 <span class="wod">红包个数：</span>
								 <input class="txt form-control" type="text" id="num0" name="hbRuleList[0].num" onblur="shijiao(0)"/>
								 <span class="tip"><span>个</span></span>
								 <div class="clearfix" id="numShow0"></div>
							 </div>
							 <div class="block">
							 <span class="wod">合算红包总金额：</span>
								 <span class="name"><span id="priceNum0"></span></span>
								 <div class="clearfix"></div>
							</div>
						 </div>
						 <div id="kongbai" style="background-color:#fff;"> </div>
					 </div>
				 </div>
				 <div class="btnbox">
						 <a class="nextbtn_add" href="#" onclick="addElement()">添加</a>
						 <a class="nextbtn_add" href="#" onclick="dropElement()">删除</a>
						 <span class="tip">最多可添加5个时间段</span>
						 <div class="clearfix"></div>
					 </div>
				  <div class="block">
					  <span class="wod" style="width: 120px;">分享文案：</span>
					  <textarea class="tea form-control" id="shareContext" name="shareContext"></textarea>
					  <span class="msg-box n-right" id="shareContextShow"></span>
					  <div class="clearfix"></div>
				  </div>
				  <div class="block">
				      <div style="display: inline-block;">
				          <span class="wod" style="width: 120px;">区域类型：</span>
					      <select class="sel" id="quyutype" name="areaType" style="width: 200px;">
						  <option value="1" selected="selected" >活动指定区域</option>
						  <option value="2">精准区域</option>
						  <option value="3">不指定区域</option>
					      </select>
				      </div>
					  <ul >
					      <li>
					       <div id="tp3" style="margin: 10px 0;">
					        <span class="wod" style="width: 120px;">活动指定区域：</span>
					        <select id="test" name="provinceId" class="sel">
					         <option value="">选择省</option>
					          <c:forEach items="${Provices }" var="provice">
					   		  <option value="${provice.code }">${provice.name }</option>
					          </c:forEach>
					         </select>
					         <select id="city" name="cityId" class="sel">
					          <option value="">选择市</option>
					         </select>
					        <select id="town" name="townId" class="sel">
					             <option value="">选择区</option>
					         </select>
					         <div class="clearfix"></div>
				           </div>
				          </li>
				          <li>
				              <div class="block" id="tp4" style="display: none;margin-left: 40px;">
				  	              <div style="margin: 10px 0;">
				  	                  <span>纬度</span><input type="text" name="weidu" id="weidu" onblur="init(2)"/>&nbsp;<span>经度</span><input type="text" name="jingdu" id="jingdu" onblur="init(2)"/>&nbsp;<span>半径范围/公里</span><input type="text" name="radius" id="rad" onblur="init(2)"/>
				  	              </div>
				  	              <div style="width:603px;height:200px" id="container"></div>
				              </div>
				          </li>
					  </ul>
			      </div>
				  <div class="block">
					  <span class="wod" style="width: 120px;">选择公众号：</span>
					  <select class="sel long" name="wxdataId" id="wxdata">
						  <c:forEach items="${list}" var="li">
							  <option value="${li.id}">${li.name}</option>
						  </c:forEach>
					  </select>
					  <div class="clearfix"></div>
				  </div>
				<div class="btnbox">
					<a class="nextbtn" href="#" onclick="nextfour()">上一步</a>
					<input type="button" value="保存并生成" class="nextbtn" id="addActivity"/>
					<div class="clearfix"></div>
				</div>
			</div>
		</aside>
      </form>
</body>
<script type="text/javascript">
var sceneList = 0;
  
      //模拟下拉列表
      $("#menuinfo").selectMenu();

  $(function(){
	  $('.block').on('change','#seltype',function(){
		  var typenow=$('#seltype').val();
		
		  if (typenow==0)
		  {
			  $('#tp1').show();
			  $('#tp2').show();
			  $('#tp3').hide();
		  }
		  else if (typenow==1)
		  {
			  $('#tp1').hide();
			  $('#tp2').hide();
			  $('#tp3').show();
		  }
	  });
		
  	$("#AddMoreFileBox").click(function () {
  		if(sceneList < 5) {
  			sceneList = parseInt(sceneList)+1;
  			$("#InputsWrapper").append('<input type="text" name="sceneList['+sceneList+'].link" id="scene'+ sceneList +'" class="shezhi_box" style="display:block;"/><span class="msg-box n-right" for="sceneList['+sceneList+'].link"></span>');
          }  
  		return false;
  	});

  	$("#shan").on("click", function(){
  		if( sceneList > 1 ) {
  			$('#InputsWrapper input').last().remove();
  			sceneList--;
          }
  		return false;
  	});
  });

    </script>
     <script type="text/javascript">
    $(function(){
		  $('.block').on('change','#quyutype',function(){
			  var typenow=$('#quyutype').val();
			  if (typenow==1)
			  {
				  $('#tp3').show();
				  $('#tp4').hide();
			  }
			  else if (typenow==2)
			  {
				  $('#tp3').hide();
				  $('#tp4').show();
			  }
			  else if(typenow==3){
				  $('#tp3').hide();
				  $('#tp4').hide();
			  }
		  });
    });
    </script>
</html>